layui.define(['jquery'], function (exports) {
    var result = "";
    var $=layui.jquery;
    var ResAjax = function () {
            this.v = '0.1';
            this.result=result;
        }, _MOD = 'resAjax';

    ResAjax.prototype.render = function (options) {
        var opts = options,
            //访问的url
        url = opts.url;
        //类型
        type = opts.type || "get";
        //数据
        data = opts.data||{};
        var a={
            init: function () {

                a.resultajax(opts);

                return result;
            },
            resultajax:function(me){
                $.ajax({
                    type: me.type,
                    url: me.url,
                    dataType: 'json',
                    data: me.data,
                    async: false,
                    beforeSend: function (data) {

                    },
                    success: function (data) {
                        result = data;
                    },
                    error: function (data) {
                        result = data;
                    }
                });

            },
        };
        a.init();
        return result;
    };



    var resAjax = new ResAjax();

    exports(_MOD, resAjax);
});